<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>
    <script>
        function Person(name,age){
            this.name=name;
            this.age=age;
        }
        Person.prototype.say=function(){
            console.log(this.name+":"+this.age)
        }
        /*属性的继承
            通过call或apply改变函数内部this关键字的指向
        */
        function Teacher(name,age){
            Person.call(this,name,age)
        }
        Teacher.prototype=new Person();
        var w=new Teacher("w",30);
        w.say();//w:30
    </script>
</body>
</html>